﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace FraudMitigator
{
    public partial class AddUserForm : Form
    {
        UserData data = new UserData();

        public AddUserForm()
        {
            InitializeComponent();
        }

        private void cancelBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void addBtn_Click(object sender, EventArgs e)
        {
            data.firstName = firstNameTxtBox.Text;
            data.lastName = lastNameTxtBox.Text;
            data.username = usernameTxtBox.Text;
            data.password = passwordTxtBox.Text;
            data.accessLevel = accessLvlTxtBox.Text;

            Queries.insertUserQuery(data);
            Strings.Log(MainScreen.user.UserUsername + " added a user.");
            this.Close();
        }
    }

    public struct UserData
    {
        public string firstName { get; set; }
        public string lastName { get; set; }
        public string username { get; set; }
        public string password { get; set; }
        public string accessLevel { get; set; }

        public string newFirstName { get; set; }
        public string newLastName { get; set; }
        public string newUsername { get; set; }
        public string newPassword { get; set; }
        public string newAccessLevel { get; set; }
    }
}
